import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = in.next();
        }
        String ret = in.next();
        int k = in.nextInt();
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            if (s[i].length() == ret.length() && !s[i].equals(ret)) {
                char[] chars = s[i].toCharArray();
                char[] chars1 = ret.toCharArray();
                int flag = 1;
                Arrays.sort(chars);
                Arrays.sort(chars1);
                for (int j = 0; j < chars.length; j++) {
                    if (chars1[j] != chars[j]) {
                        flag = 0;
                        break;
                    }
                }
                if (flag == 1) {
                    set.add(s[i]);
                }
            }
        }
        System.out.println(set.size());
        String[] r = set.toArray(new String[set.size()]);
        Arrays.sort(r);
        if (k <= r.length) {
            System.out.println(r[k -1]);
        }

    }
}